--
-- Author:      name
-- DateTime:    2018-05-05 15:46:15
-- Description: 牛牛服务
local skynet = require "skynet"



local MessageDispatch = import("MessageDispatch")
local UserManager = import("GameUserManager")
local NodeMessage = import("NodeMessage")
local DeskMessage = import("DeskMessage")
local Config = import("Config")

local MessageHandler = import("txz.MessageHandler")
local Desk = import("txz.Desk")
local Rule = import("txz.Rule")



---------------------------------------------------------
-- CMD
---------------------------------------------------------

local function init()
	local node_message = NodeMessage.new()
	local message_dispatch = MessageDispatch.new()
	local message_handler = MessageHandler.new(message_dispatch)
	local desk_message = DeskMessage.new(message_dispatch)
	local user_manager = UserManager.new(node_message)
	local config = Config.new()
	local desk = Desk.new()
	local rule = Rule.new()

	global.node_message = node_message
	global.user_manager = user_manager
	global.desk_message = desk_message	
	global.message_handler = message_handler
	global.config = config
	global.desk = desk
	global.rule = rule

	skynet.dispatch("lua", message_dispatch:dispatch())
end

---------------------------------------------------------
-- skynet
---------------------------------------------------------
skynet.start(function()
	init()

end)